package cn.micai.base.thread;

/**
 * 描述：继承Thread创建线程
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/5/11 14:10
 */
public class MyThread1 extends Thread {

    public MyThread1(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i=0; i<20; i++) {
            // 输出线程名字和i
            System.out.println(this.getName() +":"+i);
        }
    }

    public static void main(String [] args) {
        // 创建5个线程
        for (int i=0; i<5; i++) {
            new MyThread1("thread" +i).start();
        }
    }
}
